package org.androidpn.server.dao.impl;

import java.util.List;

import javax.persistence.TypedQuery;

import org.androidpn.server.dao.FriendGroupDao;
import org.androidpn.server.entity.Friend;
import org.androidpn.server.entity.FriendGroup;
import org.springframework.stereotype.Repository;

/**
 * Dao 角色
 * 
 * @author 蔡琪
 * 
 */
@Repository("friendGroupDao")
public class FriendGroupDaoImpl extends BaseDaoImpl<FriendGroup, Long>
		implements FriendGroupDao {

	public List<FriendGroup> getFriendGroupByRoleID(Long roleID) {
		String jpql = "from FriendGroup friendGroup where friendGroup.role.id=:roleID order by createDate desc";
		TypedQuery<FriendGroup> query = entityManager.createQuery(jpql,
				FriendGroup.class).setParameter("roleID", roleID);
		return query.getResultList();
	}

}
